package com.yh.rent.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.yh.rent.dao.StreetDao;
import com.yh.rent.entity.Street;
import com.yh.rent.utils.HibernateUtil;

public class StreetDaoImpl implements StreetDao {
	Session session = null ;
	@Override
	public List<Street> getAllStreets() {
		session = HibernateUtil.getCurrentSession() ;
		Transaction ts = session.beginTransaction();
		Query query = session.createQuery("from Street") ;
		@SuppressWarnings("unchecked")
		List<Street> list = query.list() ;
		ts.commit();
		return list;
	}

}
